<?php

class Categories_m extends CI_Model {
	
	function display_all(){
		$res = $this->db->get("categories");
		return ($res->num_rows() > 0) ? $res->result():false;
		
	} // end function display all..
	function add_new(){
		
		if($this->input->post('category') == ""){
			return false;
		}
		
		$category = array(
			'category_name' => $this->input->post('category')
		);
		
		$res = $this->db->insert('categories',$category);
		
		return ($res) ? $this->db->insert_id():var_dump(mysql_error());
		
	} // add new function..
}// end class cetegories..